package com.android.enjoymax;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.android.enjoymax.ImageAdapter;
//import com.android.enjoymax.models.R;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class Models extends Activity implements OnClickListener {
	public static final String TAG = "MODELS";
	
	public AlertDialog.Builder dlgAlert;
	private ListView listView;
	
	 @Override
  public void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
      setContentView(R.layout.models);
      
      
    //  Button b = (Button) findViewById(R.id.button2);
     // b.setOnClickListener(this);
      
      Drawable drawable = this.getResources().getDrawable(R.drawable.background1);
      
	    //Change background of Activity       
	    getWindow().setBackgroundDrawable(drawable);
	    GridView gridview = (GridView) findViewById(R.id.grdview);
	    
	   
	
	    gridview.setAdapter(new ImageAdapter(this));
	    dlgAlert  = new AlertDialog.Builder(this);
	    
	    gridview.setOnItemClickListener(new OnItemClickListener() {
	        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
	            //Toast.makeText(Models.this, "" + position, Toast.LENGTH_SHORT).show();
	            //startActivity(new Intent(Models.this, Map.class));
	        	
	        	String[] values = new String[1];
	        	
	        	switch (position) {
				case 0: {
					values[0] = "This plan will include atleast one event that will drive you nuts. Skydiving, Jetskiing etc."; 
					break;
				}
				case 1: {
					values[0] = "This plan will include atleast one event where nature will take over and bamboozle you!!"; 
					break;
				}
				case 2: {
					values[0] = "This plan will include atleast one usual highly rated tourist spot."; 
					break;
				}
				case 3: {
					values[0] = "This plan is sure to please even the best artists in the world"; 
					break;
				}
				case 4: {
					values[0] = "This plan will align to the likes of kids and some adults alike."; 
					break;
				}
				case 5: {
					values[0] = "This plan is sure to include atleast one location that is of historical importanoursce."; 
					break;
				}
				case 6: {
					values[0] = "Need Something?? Pray your ass off at one of the locations in your itinerary"; 
					break;
				}
				case 7: {
					values[0] = "Romantic Getaway?? This one is yours"; 
					break;
				}
				
				default:
					break;
				}				
				ArrayAdapter<String> tempAdapter = new ArrayAdapter<String>(getApplicationContext(),
						R.layout.custom_layout, values);
				
				
	        	//dlgAlert.setMessage("This is an alert with no consequence");
				//dlgAlert.setTitle(R.drawable.blobnew);
				dlgAlert.setAdapter(tempAdapter, null);
	        	dlgAlert.setTitle("App Title");
	        	dlgAlert.setCancelable(true);
	        	
	        	dlgAlert.setPositiveButton("Ok",
	        		    new DialogInterface.OnClickListener() {
	        		        public void onClick(DialogInterface dialog, int which) {
	        		          //dismiss the dialog  
	        		        	
	        		        	startActivity(new Intent(Models.this, Map.class));
	        		        }
	        		    });
	        	
	        	dlgAlert.setNegativeButton("Cancel",
	        		    new DialogInterface.OnClickListener() {
	        		        public void onClick(DialogInterface dialog, int which) {
	        		          //dismiss the dialog  
	        		        	//startActivity(new Intent(Models.this, Map.class));
	        		        	dialog.cancel();
	        		        }
	        		    });
               
	        	
	        	dlgAlert.create().show();	    
	        }
			
	    });
      
}

	/*   @Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		//if (v.getId() == R.id.button2) {
			//startActivity(new Intent(Models.this, Map.class));
		//}
		
	}  */
	
	  @Override
	    public boolean onCreateOptionsMenu(Menu menu) {
	        getMenuInflater().inflate(R.menu.main, menu);
	        return true;
	    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}
	
}